<?php
	include_once(realpath(dirname(__FILE__)) . "/../../../../fonctions/authplugins.php");

	autorisation("mailjet");

	include_once(realpath(dirname(__FILE__)) . "/../Mailjet.class.php");
?>

	    <p><a href="accueil.php" class="lien04">Accueil </a><img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="module_liste.php" class="lien04">Modules</a> <img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="module.php?nom=mailjet" class="lien04">Newsletter</a> <img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="#" class="lien04">Gestion des campagnes</a></p>

<br />

<?php

	$urlsite = new Variable();
	$urlsite->charger("urlsite");
			
	$dossiernewsletter = new Variable();
	$dossiernewsletter->charger("dossiernewsletter");
?>

<table width="100%"  border="0" cellspacing="0" cellpadding="0">


<?php
	$dossier = new Dossier();
	
	$query_campagne = "select * from $dossier->table where parent= " . $dossiernewsletter->valeur . " order by classement";
	$resul_campagne = mysql_query($query_campagne, $dossier->link);

	$i = 0;


	while($row_campagne = mysql_fetch_object($resul_campagne)){
		$dossierdesc = new Dossierdesc();
		$dossierdesc->charger($row_campagne->id);

		$campagne = new Mailjet_campagne_envoi();
		$existe = $campagne->charger($dossierdesc->description);

		$i++;
		
		if($i%2)
			$fond = "claire";
		else
			$fond = "sombre";
?>
<tr class="cellule_<?php echo $fond; ?>">
  <td width="40%" height="30">&nbsp;<a href="<?php echo $urlsite->valeur; ?>/newsletter.php?id_dossier=<?php echo $row_campagne->id; ?>" target="_blank"><?php echo $dossierdesc->titre; ?></a></td>
  <td width="30%" height="30">
  	<?php 
  		if(! $existe){
  	?>
 		En attente
  <?php
  	}
  ?>
  </td>
  <td width="20%" height="30">
  <?php
   		if(! $existe){ 
  ?>
    <div align="left"><a href="module.php?nom=mailjet&action_mailjet=envoyer&id=<?php echo $row_campagne->id; ?>">Envoyer</a></div>
    <?php
    	} else if($campagne->statut == "1"){
    ?>
    	Envoy&eacute;e
    <?php
    	}	
    ?>
  </td>
</tr>
<?php
	}
?>
</table>